//
//  AppChangeThemeManage.swift
//  XMenSwift
//
//  Created by Jason on 2023/8/10.
//

import UIKit
import SwiftTheme

///全局通用颜色
class GlobalColorPicker: NSObject {
    //333333
    @objc static var color333333: String = "#333333"
    
}

///默认主题色
class DefaultThemePicker: NSObject {
    //主题颜色
    @objc static var mainColor: String = "#2C417D"
    
    //副主题颜色
    @objc static var viceColor: String = "#F1B85E"
    
    //主字体名称
    @objc static var mainFontName: String = "Boreal"
    
    //副字体名称
    @objc static var viceFontName: String = "Boreal"
    
}

///服务端下发配置主题
class ConfigThemeModel: NSObject {
    
    //主题颜色
    @objc var mainColor: String = "#E60000"
    
    //副主题颜色
    @objc var viceColor: String = "#303030"
    
    //主字体名称
    @objc var mainFontName: String = "Boreal"
    
    //副字体名称
    @objc var viceFontName: String = "Boreal"
    
}


@objc class AppThemeConfigManage: NSObject {
    
    @objc static let shared = AppThemeConfigManage()
    
    @objc var currentType: ThemeType = .default
    
    //服务端下发
    var themeModel: ConfigThemeModel = ConfigThemeModel()
    
    @objc var mainBackgroundColor: ThemeColorPicker {
        return [DefaultThemePicker.mainColor, self.themeModel.mainColor]
    }
    
    @objc var viceBackgroundColor: ThemeColorPicker {
        return [DefaultThemePicker.viceColor, self.themeModel.viceColor]
    }
    
    @objc var mainTextColor: ThemeColorPicker {
        return [DefaultThemePicker.mainColor, self.themeModel.mainColor]
        
    }
    
    @objc var viceTextColor: ThemeColorPicker {
        return [DefaultThemePicker.viceColor, self.themeModel.viceColor]
    }
    
    //在此处添加自定义字体
    func getFont(currentType:ThemeType = .default, style: FontStyle = .main, weight: FontWeightStyle = .regular) -> String {
        //默认字体
        if currentType == .default && weight == .regular && style == .main  {
            return "Boreal-Regular"
        }
        if currentType == .default && weight == .medium && style == .main {
            return "Boreal-Medium"
        }
        if currentType == .default && weight == .bold && style == .main {
            return "Boreal-Bold"
        }
        if currentType == .default && weight == .regular && style == .vice  {
            return "Boreal-Regular"
        }
        if currentType == .default && weight == .medium && style == .vice {
            return "Boreal-Medium"
        }
        if currentType == .default && weight == .bold && style == .vice {
            return "Boreal-Bold"
        }
        //其它字体
        if currentType == .other && weight == .regular && style == .main  {
            return "\(self.themeModel.mainFontName)-Regular"
        }
        if currentType == .other && weight == .medium && style == .main {
            return "\(self.themeModel.mainFontName)-Medium"
        }
        if currentType == .other && weight == .bold && style == .main {
            return "\(self.themeModel.mainFontName)-Bold"
        }
        if currentType == .other && weight == .regular && style == .vice  {
            return "\(self.themeModel.viceFontName)-Regular"
        }
        if currentType == .other && weight == .medium && style == .vice {
            return "\(self.themeModel.viceFontName)-Medium"
        }
        if currentType == .other && weight == .bold && style == .vice {
            return "\(self.themeModel.viceFontName)-Bold"
        }
        return ""
    }
    
    
}

